/*
 * 
 */
package testDice;

import static org.junit.Assert.*;

import org.junit.*;

//import junit.framework.*;
import java.io.*;
import java.util.Scanner;

import dice.*;
//import player.*;

public class testDiceWindow {
	InputStream stdin;
	@Before
	public void setUp() {
		String data = "H"; 
		/*InputStream */stdin = System.in; 
		try {   
			System.setIn(new ByteArrayInputStream(data.getBytes()));
			Scanner scanner = new Scanner(System.in);	
			System.out.println(scanner.nextLine());
		} finally {
			System.setIn(stdin); 
		}
		
		
	}
		
	@Test
	public void testPromptRollDice() {	
		ByteArrayOutputStream testOut = new ByteArrayOutputStream();
		PrintStream testOutPrintStream = new PrintStream(testOut);
		System.setOut(testOutPrintStream);
		
		 
		
		DiceWindow dice = new DiceWindow();
		System.setIn(stdin); 
		dice.promptRollDice(2);	

		
			
		String newLine = System.getProperty("line.separator");
		if (newLine == null) newLine = "\n";

		String expected = "Player 2, now is your turn" + newLine;
		expected = expected + "Press enter to roll a dice..." + newLine;
		
		assertEquals(expected, testOut.toString());
		
	}

}
